<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <title>二维码生成工具</title>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="../static/img/favicon.ico">
    <link rel="stylesheet" href="index.css" />
    <script type="text/javascript" src="../static/vendor/evalCore.min.js"></script>
    <script type="text/javascript" src="../static/vendor/vue/vue.js"></script>
</head>
<body>

    <div class="wrapper" id="pageContainer">
        <div class="panel panel-default" style="margin-bottom: 0px;">
            <div class="panel-heading">
                <h3 class="panel-title">
                    <a href="https://www.baidufe.com/fehelper/index/index.html" target="_blank" class="x-a-high">
                        <img src="../static/img/fe-16.png" alt="fehelper"/> FeHelper</a>：二维码{{qrEncodeMode? '生成':'解码'}}器

                    <span class="x-switch ui-fl-r" ref="btnSwitch" @click="trans">切换为{{!qrEncodeMode? ' 二维码生成器 ' : ' 解码/扫码 '}}模式&gt;&gt;</span>
                </h3>
            </div>
        </div>

        <div class="panel-body mod-json">

            <div v-if="qrEncodeMode">
                <div class="row">
                    <textarea class="form-control mod-textarea" id="codeSource" ref="codeSource" v-model="textContent" placeholder="在这里填写需要生成二维码的任意内容"></textarea>
                </div>

                <div class="row ui-mt-10">

                    <div class="ui-d-ib x-sizes">
                        尺寸：<input name="opt_width" type="text" id="opt_width" v-model="qrSize" size="4" maxlength="4"/>
                    </div>
                    <div class="ui-d-ib x-colors">
                        颜色：<input type="text" id="opt_fc" v-model="qrColor" size="10" />
                    </div>

                    <div class="radio ui-d-ib x-icons">
                        图标：<label><input id="remove_icon" name="qr_icon" type="radio" value="no" v-model="useIcon" @click="convert()">不要</label>
                    </div>

                    <div class="radio ui-d-ib ui-ml-10">
                        <label><input id="default_icon" name="qr_icon" type="radio" value="default" v-model="useIcon" @click="convert()">默认</label>
                    </div>

                    <div class="radio ui-d-ib ui-ml-10">
                        <label><input id="upload_icon" name="qr_icon" type="radio" value="custom" v-model="useIcon" @click="$refs.fileBox.click()">上传</label>
                        (提示:支持直接拖拽一个图标到页面)
                    </div>

                    <button id="confirm_button" class="btn btn-success ui-fl-r" @click="convert()">生成QR图</button>
                </div>

                <div class="row ui-mt-20" v-if="showResult">
                    <h4>结果</h4>
                    <hr class="x-hr"/>
                    <div id="preview"></div>
                </div>
            </div>

            <div class="row" v-if="!qrEncodeMode">
                <table>
                    <tr>
                        <td>
                            <div class="x-panel" ref="panelBox">
                                <img id="decodePreview" alt="" :src="previewSrc" v-show="!!previewSrc.length">
                                <div class="x-tips">
                                    <a id="upload" href="#" ref="uploadBox" @click="$refs.fileBox.click()">选择图片</a><br>
                                    或者选择一张图片拖拽图片到这里来
                                </div>
                            </div>

                            <div class="tips">
                                1、支持<i>屏幕截图</i>后直接在此处粘贴进行解码<br/>2、支持<i>复制文件、复制图片</i>在线地址在此处直接粘贴进行解码
                            </div>
                        </td>
                        <td>
                            <textarea id="decodeResult" title="点击自动选择" placeholder="内容会自动生成..." readonly ref="resultBox" @click="select()" v-model="resultContent" class="form-control"></textarea>
                        </td>
                    </tr>
                </table>
                <img id="img" alt="">
            </div>

        </div>

        <div class="x-logo">
            <img src="../static/img/fe-48.png" alt="#" id="logo_default" ref="logoDefault"/>
            <img src="../static/img/fe-48.png" alt="#" id="logo" ref="logoCustom"/>

            <form action="#">
                <input type="file" id="file" ref="fileBox" accept=".jpg,.jpeg,.gif,.png,.bmp" @change="fileChanged($event)">
            </form>
        </div>
    </div>

    <script type="text/javascript" src="../static/vendor/jquery/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../static/vendor/jquery/jquery.colorpicker.js"></script>
    <script type="text/javascript" src="../static/vendor/jquery/jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="../static/vendor/zxing/zxing.min.js"></script>
    <script type="text/javascript" src="index.js"></script>
</body>
</html>
